Left Termination of the query pattern balance_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

balance(T, TB) :- balance55(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []).
balance55(nil, C, T, T, A, B, A, B, X, X).
balance55(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) :- ','(balance55(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)), balance55(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)).
balance5(nil, C, T, T, A, B, A, B, X, X) :- balance55(nil, C, T, T, A, B, A, B, X, X).
balance5(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) :- balance55(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT).
balance(nil, -(X, X), -(A, B), -(A, B), -(.(','(nil, -(C, C)), T), T)) :- balance5(nil, C, T, T, A, B, A, B, X, X).
balance(tree(L, V, R), -(IH, IT), -(.(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T))), -(HR, TR), -(.(','(nil, -(XX0, XX0)), XX1), NT)) :- balance5(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT).

Queries:

balance(g,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
balance_in: (b,f)
balance55_in: (b,f,f,b,f,b,f,f,f,b) (b,f,f,f,f,f,f,f,f,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

balance_in_ga(T, TB) → U1_ga(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
balance55_in_gaagagaaag(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaagagaaag(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U1_ga(T, TB, balance55_out_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])) → balance_out_ga(T, TB)

The argument filtering Pi contains the following mapping:
balance_in_ga(x1, x2)  =  balance_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
balance55_in_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaagagaaag(x1, x4, x6, x10)
nil  =  nil
balance55_out_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaagagaaag
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U2_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaagagaaag(x3, x6, x8, x18, x19)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U3_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaagagaaag(x19)
[]  =  []
balance_out_ga(x1, x2)  =  balance_out_ga

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

balance_in_ga(T, TB) → U1_ga(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
balance55_in_gaagagaaag(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaagagaaag(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U1_ga(T, TB, balance55_out_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])) → balance_out_ga(T, TB)

The argument filtering Pi contains the following mapping:
balance_in_ga(x1, x2)  =  balance_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
balance55_in_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaagagaaag(x1, x4, x6, x10)
nil  =  nil
balance55_out_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaagagaaag
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U2_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaagagaaag(x3, x6, x8, x18, x19)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U3_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaagagaaag(x19)
[]  =  []
balance_out_ga(x1, x2)  =  balance_out_ga


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

BALANCE_IN_GA(T, TB) → U1_GA(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
BALANCE_IN_GA(T, TB) → BALANCE55_IN_GAAGAGAAAG(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])
BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → BALANCE55_IN_GAAAAAAAAA(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → BALANCE55_IN_GAAAAAAAAA(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))
U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAAAAAAAA(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)
U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAGAGAAAG(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)

The TRS R consists of the following rules:

balance_in_ga(T, TB) → U1_ga(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
balance55_in_gaagagaaag(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaagagaaag(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U1_ga(T, TB, balance55_out_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])) → balance_out_ga(T, TB)

The argument filtering Pi contains the following mapping:
balance_in_ga(x1, x2)  =  balance_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
balance55_in_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaagagaaag(x1, x4, x6, x10)
nil  =  nil
balance55_out_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaagagaaag
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U2_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaagagaaag(x3, x6, x8, x18, x19)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U3_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaagagaaag(x19)
[]  =  []
balance_out_ga(x1, x2)  =  balance_out_ga
U2_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAAAAAAAA(x3, x19)
BALANCE55_IN_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAAAAAAAA(x1)
U3_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_GAAAAAAAAA(x19)
U2_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAGAGAAAG(x3, x6, x8, x18, x19)
BALANCE_IN_GA(x1, x2)  =  BALANCE_IN_GA(x1)
U3_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_GAAGAGAAAG(x19)
BALANCE55_IN_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAGAGAAAG(x1, x4, x6, x10)
U1_GA(x1, x2, x3)  =  U1_GA(x3)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

BALANCE_IN_GA(T, TB) → U1_GA(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
BALANCE_IN_GA(T, TB) → BALANCE55_IN_GAAGAGAAAG(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])
BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → BALANCE55_IN_GAAAAAAAAA(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → BALANCE55_IN_GAAAAAAAAA(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))
U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAAAAAAAA(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)
U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAGAGAAAG(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)

The TRS R consists of the following rules:

balance_in_ga(T, TB) → U1_ga(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
balance55_in_gaagagaaag(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaagagaaag(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U1_ga(T, TB, balance55_out_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])) → balance_out_ga(T, TB)

The argument filtering Pi contains the following mapping:
balance_in_ga(x1, x2)  =  balance_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
balance55_in_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaagagaaag(x1, x4, x6, x10)
nil  =  nil
balance55_out_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaagagaaag
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U2_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaagagaaag(x3, x6, x8, x18, x19)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U3_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaagagaaag(x19)
[]  =  []
balance_out_ga(x1, x2)  =  balance_out_ga
U2_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAAAAAAAA(x3, x19)
BALANCE55_IN_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAAAAAAAA(x1)
U3_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_GAAAAAAAAA(x19)
U2_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAGAGAAAG(x3, x6, x8, x18, x19)
BALANCE_IN_GA(x1, x2)  =  BALANCE_IN_GA(x1)
U3_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_GAAGAGAAAG(x19)
BALANCE55_IN_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAGAGAAAG(x1, x4, x6, x10)
U1_GA(x1, x2, x3)  =  U1_GA(x3)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 5 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAAAAAAAA(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → BALANCE55_IN_GAAAAAAAAA(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))

The TRS R consists of the following rules:

balance_in_ga(T, TB) → U1_ga(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
balance55_in_gaagagaaag(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaagagaaag(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U1_ga(T, TB, balance55_out_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])) → balance_out_ga(T, TB)

The argument filtering Pi contains the following mapping:
balance_in_ga(x1, x2)  =  balance_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
balance55_in_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaagagaaag(x1, x4, x6, x10)
nil  =  nil
balance55_out_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaagagaaag
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U2_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaagagaaag(x3, x6, x8, x18, x19)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U3_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaagagaaag(x19)
[]  =  []
balance_out_ga(x1, x2)  =  balance_out_ga
U2_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAAAAAAAA(x3, x19)
BALANCE55_IN_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAAAAAAAA(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_GAAAAAAAAA(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAAAAAAAA(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → BALANCE55_IN_GAAAAAAAAA(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))

The TRS R consists of the following rules:

balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)

The argument filtering Pi contains the following mapping:
nil  =  nil
tree(x1, x2, x3)  =  tree(x1, x2, x3)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U2_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAAAAAAAA(x3, x19)
BALANCE55_IN_GAAAAAAAAA(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAAAAAAAA(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

BALANCE55_IN_GAAAAAAAAA(tree(L, V, R)) → BALANCE55_IN_GAAAAAAAAA(L)
U2_GAAAAAAAAA(R, balance55_out_gaaaaaaaaa) → BALANCE55_IN_GAAAAAAAAA(R)
BALANCE55_IN_GAAAAAAAAA(tree(L, V, R)) → U2_GAAAAAAAAA(R, balance55_in_gaaaaaaaaa(L))

The TRS R consists of the following rules:

balance55_in_gaaaaaaaaa(nil) → balance55_out_gaaaaaaaaa
balance55_in_gaaaaaaaaa(tree(L, V, R)) → U2_gaaaaaaaaa(R, balance55_in_gaaaaaaaaa(L))
U2_gaaaaaaaaa(R, balance55_out_gaaaaaaaaa) → U3_gaaaaaaaaa(balance55_in_gaaaaaaaaa(R))
U3_gaaaaaaaaa(balance55_out_gaaaaaaaaa) → balance55_out_gaaaaaaaaa

The set Q consists of the following terms:

balance55_in_gaaaaaaaaa(x0)
U2_gaaaaaaaaa(x0, x1)
U3_gaaaaaaaaa(x0)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAGAGAAAG(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)
BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))

The TRS R consists of the following rules:

balance_in_ga(T, TB) → U1_ga(T, TB, balance55_in_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, []))
balance55_in_gaagagaaag(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaagagaaag(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U2_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaagagaaag(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaagagaaag(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaagagaaag(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)
U1_ga(T, TB, balance55_out_gaagagaaag(T, XX0, XX1, [], .(','(nil, -(XX0, XX0)), XX1), [], .(','(TB, -(I, [])), X), X, I, [])) → balance_out_ga(T, TB)

The argument filtering Pi contains the following mapping:
balance_in_ga(x1, x2)  =  balance_in_ga(x1)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
balance55_in_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaagagaaag(x1, x4, x6, x10)
nil  =  nil
balance55_out_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaagagaaag
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U2_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaagagaaag(x3, x6, x8, x18, x19)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U3_gaagagaaag(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaagagaaag(x19)
[]  =  []
balance_out_ga(x1, x2)  =  balance_out_ga
U2_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAGAGAAAG(x3, x6, x8, x18, x19)
BALANCE55_IN_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAGAGAAAG(x1, x4, x6, x10)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → BALANCE55_IN_GAAGAGAAAG(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)
BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_GAAGAGAAAG(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))

The TRS R consists of the following rules:

balance55_in_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X) → balance55_out_gaaaaaaaaa(nil, C, T, T, A, B, A, B, X, X)
balance55_in_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT) → U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1)))
U2_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(L, XX0, XX1, .(','(nil, -(XX2, XX2)), XX3), HR1, TR1, H, T, IH, .(V, IT1))) → U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_in_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT))
U3_gaaaaaaaaa(L, V, R, XX0, XX1, NT, HR, TR, LB, VB, RB, A, D, H, X, T, IH, IT, balance55_out_gaaaaaaaaa(R, XX2, XX3, NT, HR, TR, HR1, TR1, IT1, IT)) → balance55_out_gaaaaaaaaa(tree(L, V, R), XX0, XX1, NT, HR, TR, .(','(tree(LB, VB, RB), -(A, D)), H), .(','(LB, -(A, .(VB, X))), .(','(RB, -(X, D)), T)), IH, IT)

The argument filtering Pi contains the following mapping:
nil  =  nil
tree(x1, x2, x3)  =  tree(x1, x2, x3)
balance55_in_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_in_gaaaaaaaaa(x1)
balance55_out_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  balance55_out_gaaaaaaaaa
U2_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_gaaaaaaaaa(x3, x19)
U3_gaaaaaaaaa(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U3_gaaaaaaaaa(x19)
U2_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19)  =  U2_GAAGAGAAAG(x3, x6, x8, x18, x19)
BALANCE55_IN_GAAGAGAAAG(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10)  =  BALANCE55_IN_GAAGAGAAAG(x1, x4, x6, x10)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

BALANCE55_IN_GAAGAGAAAG(tree(L, V, R), NT, TR, IT) → U2_GAAGAGAAAG(R, NT, TR, IT, balance55_in_gaaaaaaaaa(L))
U2_GAAGAGAAAG(R, NT, TR, IT, balance55_out_gaaaaaaaaa) → BALANCE55_IN_GAAGAGAAAG(R, NT, TR, IT)

The TRS R consists of the following rules:

balance55_in_gaaaaaaaaa(nil) → balance55_out_gaaaaaaaaa
balance55_in_gaaaaaaaaa(tree(L, V, R)) → U2_gaaaaaaaaa(R, balance55_in_gaaaaaaaaa(L))
U2_gaaaaaaaaa(R, balance55_out_gaaaaaaaaa) → U3_gaaaaaaaaa(balance55_in_gaaaaaaaaa(R))
U3_gaaaaaaaaa(balance55_out_gaaaaaaaaa) → balance55_out_gaaaaaaaaa

The set Q consists of the following terms:

balance55_in_gaaaaaaaaa(x0)
U2_gaaaaaaaaa(x0, x1)
U3_gaaaaaaaaa(x0)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: